export default {
  namespaced: true,
  state: {
    range: Number(localStorage.getItem("pcRange")) || 10,
    level: Number(localStorage.getItem("pcLevel")) || 15,
    recordFail: localStorage.getItem("pcRecordFail")
      ? JSON.parse(localStorage.getItem("pcRecordFail"))
      : true,
  },
  mutations: {
    setRange(state, range) {
      state.range = range;
      localStorage.setItem("pcRange", range);
    },
    setLevel(state, level) {
      state.level = level;
      localStorage.setItem("pcLevel", level);
    },
    setRecordFail(state, val) {
      state.recordFail = val;
      localStorage.setItem("pcRecordFail", val);
    },
  },
};
